package com.sinog.biz.service.business;

import com.sinog.core.model.UploadAppendixFile;
import com.sinog.core.utilbean.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.io.IOException;
import java.util.Map;

/**
 * @desc 提供ftpUtilService去biz中获取
 * @author wangxj
 * @date 2021/12/6 15:41
 */
@RestController
public interface FtpUtilService {

    /**
     * 获取ftpClient信息
     * @return return
     */
    @PostMapping("/ftp/path/getFtpClient")
    Map<String,String> getFtpClient();

    /**
     * 从ftp判断文件是否存在
     * @param uploadAppendixFile uploadAppendixFile
     * @param type type
     * @return int
     */
    @RequestMapping("/ftp/path/fileIsExistence")
    int fileIsExistence(@RequestBody UploadAppendixFile uploadAppendixFile,@RequestParam("type") String type);

    /**
     * 从ftp下载文件到本地
     * @param realPath realPath
     * @param filepath filepath
     */
    @RequestMapping("/ftp/path/downLoadFromFtp")
    void downLoadFromFtp(@RequestParam("realPath") String realPath,@RequestParam("filepath") String filepath);

    /**
     * 异步上传ftp
     * @param datapath datapath
     * @param filePath filePath
     */
    @RequestMapping("/ftp/path/uploadFileToFtp")
    void uploadFileToFtp(@RequestParam("datapath") String datapath,@RequestParam("filePath") String filePath);

    /**
     * 培训文件远程上传
     * @param originalFilename 文件名
     * @param originalFilePath 文件路径
     * @param desc desc
     * @return Result
     * @throws IOException
     */
    @RequestMapping("/ftp/path/uploadFileToFtpRemote")
    Result uploadFileToFtpRemote(@RequestParam("originalFilename") String originalFilename,@RequestParam("originalFilePath") String originalFilePath,@RequestParam("desc")String desc) throws IOException;
    /**
     * 填写信息
     * @param uploadAppendixFile uploadAppendixFile
     * @param path path
     * @param sfbdatapath sfbdatapath
     */
    @RequestMapping("/ftp/path/downLoadFromFtp3")
    void downLoadFromFtp3(
            @RequestBody UploadAppendixFile uploadAppendixFile,
            @RequestParam("path") String path,@RequestParam("sfbdatapath") String sfbdatapath);

    /**
     * 填写信息
     * @param s s
     * @param fileUrl fileUrl
     */
    @RequestMapping("/ftp/path/downLoadFromFtp5")
    void downLoadFromFtp5(@RequestParam("s") String s,@RequestParam("fileUrl") String fileUrl);

    /**
     * 下载文件重载6
     * @param fileJson fileJson
     * @param path path
     * @param datapath datapath
     * @return String
     */
    @RequestMapping("/ftp/path/downLoadFromFtp6")
    String downLoadFromFtp6(
            @RequestParam("fileJson") String fileJson,
            @RequestParam("path") String path,@RequestParam("datapath") String datapath);

    /**
     * 下载文件重载7
     * @param path path
     * @param realPath realPath
     * @param pathTemp pathTemp
     * @return File
     */
    @RequestMapping("/ftp/path/uploadFileToFtp7")
    File uploadFileToFtp7(@RequestParam("path") String path,@RequestParam("realPath") String realPath,@RequestParam("pathTemp") String pathTemp);

    /**
     * 浏览所有培训文件的列表
     * @param flag 状态标识 0：上架 1：下架
     * @return String
     */
    @GetMapping("/azbj/spgl/getAllVideos")
    String selectAllVideos(@RequestParam("flag") String flag);

    /**
     * 更新文件上架状态
     * @param name 文件名
     * @param status 状态标识 0：上架 1：下架
     * @return Result
     */
    @RequestMapping("/azbj/spgl/updateVideos")
    Result updateVideo(@RequestParam("name")String name,@RequestParam("status")String status);

    /**
     * 删除文件以及远程文件
     * @param uploadFilePathName 本地上传文件全路径
     * @param originalFilename 文件名称
     * @return
     */
    @RequestMapping("/azbj/spgl/deleteLocal")
    Result delete(@RequestParam("uploadFilePathName")String uploadFilePathName,@RequestParam("originalFilename")String originalFilename);

    /**
     * 文件从ftp下载
     * @param fileName 真实文件名称
     * @param realPath 文件全路径
     */
    @RequestMapping("/azbj/spgl/downFromFtp")
    void downLoadVideoFromFtp(@RequestParam("fileName") String fileName,@RequestParam("realPath") String realPath);
}